package cn.htsyb.synergy.orm.jpa.model.entity;

import cn.htsyb.synergy.orm.constant.ValidStatus;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.io.Serializable;

/**
 * @author lakeside hubin_yuan.410@hotmail.com
 * @version V1.0.0
 * @date 2022/5/11
 * @since 1.0
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Setter
@Getter
@NoArgsConstructor
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
@Schema(description = "实体(简化)抽象类")

public abstract class AbsIdStatusEntity implements Serializable {
    @Id
    @GeneratedValue(generator = "hibernate-uuid")
    @GenericGenerator(name = "hibernate-uuid", strategy = "uuid2")
    @Column(name = "id_", length = 36, columnDefinition = " VARCHAR(36) COMMENT '逻辑编号' ")
    @Schema(name = "id", description = "逻辑编号")
    protected String id;

    /**
     * 有效状态
     */
    @Basic
    @Column(name = "valid_status", length = 20, columnDefinition = "varchar(20) COMMENT '有效状态'")
    @Schema(name = "validStatus", description = "有效状态")
    @Enumerated(EnumType.STRING)
    protected ValidStatus validStatus = ValidStatus.enabled;

}
